home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR02 / DCGAMES1.ZIP / NEWGAME.ZIP / QUESTER.SCR < prev    next >
Text File  |  1992-12-19  |  4KB  |  165 lines

  1. !
  2. ! Default quester script..
  3. !
  4. ! (c) DC Software, 1992
  5. !
  6.  
  7. !------------------------------------------------------------------------!
  8. :@TALK ! Talk to the character !
  9. !------------------------------------------------------------------------!
  10.  
  11. ! No more quests?
  12.   if npc.v1 = 16 GOTO NOMORE;
  13.  
  14. ! Always talk to the leader of the pack..
  15.   group.current = 0;
  16.  
  17. ! Initialize the first time through..
  18.   if npc.v0 = 0 then
  19.     npc.v0 = 1;  ! We've talked, but no quest is pending..
  20.     npc.v1 = 0;  ! Do quest 0 first.
  21.   else
  22.     if npc.v0 = 2 goto QUEST; ! We already have a quest..
  23.   endif;
  24.  
  25. ! Select the item to be quested..
  26. :LOOP
  27.   setbp( npc, npc.v1 );
  28.   if npc.bp.count = 0 then
  29.     inc( npc.v1 );       ! The slot is empty, check the next one !
  30.     if npc.v1 = 16 
  31.        goto NOMORE;      ! We've got no more quests !
  32.     goto LOOP;
  33.   endif;
  34.  
  35. :START
  36.   writeln( "Are you in need of a quest?" );
  37.  
  38.   L1 = select( "Yes", "No", "Talk", "Bye" );
  39.   ON L1 GOTO QYES, QNO, CHAT, CSTOP;
  40.  
  41. :QYES
  42.   setbp( npc, npc.v1 );  ! Set the backpack, just to make sure..
  43.   writeln( "I'll pay you ", $npc.bp.value, " if you bring me the ", npc.bp.name );
  44.   writeln( "Good luck.." );
  45.   npc.v0 = 2; ! Quest Given
  46.   STOP;
  47.  
  48. :QNO
  49.   writeln( "Then be on your way please.." );
  50.   STOP;
  51.  
  52. !
  53. ! We HAVE a quest
  54. !
  55. :QUEST
  56.   setbp( npc, npc.v1 ); ! Select the quest that was given.. !
  57.   writeln( player.name, "! Have you brought me the ", npc.bp.name, "?" );
  58.   voice( "Quest" );
  59.  
  60.   L1 = select( "Yes", "No", "Talk", "Bye" );
  61.   on L1 goto CYES, CNO, CHAT;
  62.   goto CSTOP;
  63.  
  64. :CYES
  65.  
  66. ! Find out WHO has the item
  67.   L2 = find( player, npc.bp.name );
  68.   IF L2 < 0 GOTO NOTHERE;
  69.   group.current = L2;
  70.  
  71. ! If the player's name matches the backpack name, its a RESCUE !
  72.   if player.name = npc.bp.name then
  73.     writeln( player.name, "! I almost didn't recognize you.." );
  74.     ! 
  75.     ! When the rescued person leaves the party, take the following actions
  76.     !
  77.     player.v1 = 2;              ! 1 when I join the party.  2 on delivery! 
  78.     if( player.text >= 0 ) then
  79.       inc( player.text );       ! Change text block (if any)
  80.     endif;
  81.     if( player.voice >= 0 ) then
  82.       inc( player.voice );   ! Change voice file (if any)
  83.     endif;
  84.     if( player.picture >= 0 ) then
  85.       inc( player.picture );   ! Change picture file (if any)
  86.     endif;
  87.     leave( player.index );      ! Remove from the party
  88.     group.current = 0;
  89.   else
  90.     ! Otherwise, the quested item is in the player's backpack.
  91.     L2 = find( player.bp, npc.bp.name, npc.bp.type );
  92.     if L2 < 0 GOTO NOTHERE;
  93.     vanish( player.bp );
  94.   endif;
  95.  
  96. ! Now give a reward..
  97.   inc( group.gold, npc.bp.value );               ! Pay for it !
  98.   writeln( $npc.bp.value, " is the reward.  Here it is." );
  99.  
  100.   if npc.bp.weight > 0 then
  101.     L4 = npc.bp.weight;                          ! Experience is given here !
  102.   else
  103.     L4 = npc.bp.value / 10 * (random(3)+1) + 1;  ! Give random experience !
  104.   endif;
  105.  
  106. ! Do the whole party..
  107.   foreach player do
  108.     inc( player.exp, L4 );    ! Level promotions are automatic !
  109.   endfor;
  110.  
  111.   if npc.bp.endgame = END_ON_GIVE then
  112.     if npc.bp.endtext > 0 then
  113.       readtext( npc.bp.endtext );
  114.     endif;
  115.     ENDGAME;
  116.   endif;
  117.  
  118. :CSTOP
  119.   writeln( "May the force be with you." );
  120.   STOP;
  121.  
  122. :CNO
  123.   writeln( "Why are you back then?" );
  124.   GOTO CHAT1;
  125.  
  126. !
  127. ! Conversation is optional for a healer, but this one likes to chat..
  128. !
  129. :CHAT
  130.   writeln( "What would you like to talk about?" );
  131.  
  132. :CHAT1
  133.   L3 = getstr("Name","Where","Quest","Bye");
  134.  
  135. ! First, see if the keyword typed is in the character's text block !
  136.   if dotext( S0 ) goto CHAT1;
  137.  
  138. ! It didn't, so try the predefined ones..
  139.   on L3 goto CName, WHERE, START, CSTOP;
  140.  
  141. ! Nope, try a 'DEFAULT' line
  142.   if not dotext( "DEFAULT" ) then
  143.     writeln( "I don't know anything about that!" );
  144.   endif;
  145.   goto CHAT1;
  146.  
  147. :CName
  148.   writeln( "My name is ", npc.name, "."        );
  149.   GOTO CHAT1;
  150.  
  151. :WHERE
  152.   writeln( "If I knew where, I wouldn't need your services!" );
  153.   GOTO CHAT1;
  154.  
  155. :NOMORE
  156.   writeln( "Sorry, I have no more quests." );
  157.   STOP;
  158.  
  159. :NOTHERE
  160.   writeln( "You don't have the ", npc.bp.name, " with you." );
  161.   writeln( "Are you sure you found it?" );
  162.   L3 = select( "Yes", "No", "Maybe", "What", "Who", "Ugh..", "Bye" );
  163.   writeln( "Hmm..  Come back when you find it.." );
  164.   STOP;
  165.